package test6

object TestCase {
  def main(args: Array[String]): Unit = {
    val a= Array(2, 1, 3, 5, 3, 2)
    def swapElementsOfArray(array: Array[Int]) ={
      array match {
        case Array(x, y, z @ _*) => Array(y, x) ++ z
        case _ => array
      }
      array.foreach(println)
    }

    println("\n>>>>>>>>>>>>>>>>>>>>>>>>")
    swapElementsOfArray(a)
    println("\n>>>>>>>>>>>>>>>>>>>>>>>>")
    a.foreach(println)
  }
}
